<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="utf-8">
		<script src="http://ai.aijkang.com/expert/php/redirectwechatURL.php"></script>
		<script class="get-ticket" src="http://ai.aijkang.com/expert/php/getjsapi_ticket.php"></script>
		<script>
			var scale = 1 / window.devicePixelRatio;
			document.write('<meta name="viewport" content="width=device-width,initial-scale='+scale+',minimum-scale='+scale+',maximum-scale='+scale+',user-scalable=no" />');
			var html = document.getElementsByTagName('html')[0];
			var pageHeight = Math.max(html.getBoundingClientRect().height, window.innerHeight);
			var pageWidth = Math.max(html.getBoundingClientRect().width, window.innerWidth);
			var UA=window.navigator.userAgent.toLowerCase();
			var isPC=false;
			// if(移动端or屏幕宽高比为竖屏) ==> 取屏幕宽度÷7.5计算font-size
			if((UA.indexOf('mobile')>-1 || UA.indexOf('android')>-1 || UA.indexOf('ucweb')>-1) && pageWidth/pageHeight<=0.75){
				html.style.fontSize = pageWidth/7.5 + 'px'
			} else {
				// 否则(PC浏览器中) ==> 取屏幕高度计算9/16,再÷7.5计算font-size
				window.isPC=true;
				html.style.fontSize = pageHeight*9/16/7.5+'px';
			}
		</script>
		<script>
			var head=document.getElementsByTagName('head')[0];
			// !function(){
			// 	if(UA.indexOf('micromessenger')>-1){
			// 		var script=document.createElement('script');
			// 		script.setAttribute('src','http://www.aijkang.com/expert/php/redirectwechatURL.php');
			// 		head.appendChild(script);
			// 		window.getTicket();
			// 	}
			// }()
			function getTicket(){
				var s=head.getElementsByClassName('get-ticket');
				if(s && s.length){
					head.removeChild(s[0]);
				}
				var script=document.createElement('script');
				script.setAttribute('class','get-ticket');
				script.setAttribute('src','http://ai.aijkang.com/expert/php/getjsapi_ticket.php');
				head.appendChild(script);
			}
			function getNewTicket(){
				var valid=false;
				if(window.jsapi_ticket){
					var myTime = new Date().getTime();
					var serverTime = myTime - window.jsapi_timeDiff;
					if(serverTime-window.jsapi_createTime>7200000){
						valid=false;
					} else {
						valid=true;
					}
				}
				if(valid==false){
					window.getTicket();
				}
				return valid;
			}
		</script>
		<title>智能保险专家</title>
		<style>
			.pc {
				position: relative;
				height: 100%;
				margin: 0 auto;
			}
			.abs {
				position: absolute;
				z-index: 1;
			}
			.rel {
				position: relative;
			}
			.full {
				width: 100%;
				height: 100%;
			}
			.overflow-hidden {
				overflow: hidden;
			}
			html,body{
				margin: 0;
				padding: 0;
				width: 100%;
				height: 100%;
				overflow: hidden;
				background: #111;
			}
			.abs.welcome {
				z-index: 5;
				background: #061a3c;
				transition: all 1s;
			}
			.abs.welcome.hide {
				opacity: 0;
			}
			.welcome .grad {
				width: 27.5rem;
				height: 27.5rem;
				background: radial-gradient(white, #061a3c, #061a3c);
			}
			.welcome .grad1 {
				left: -10rem;
				top: -20rem;
				animation: left-right 12s infinite linear;
			}
			.welcome .grad2 {
				left: -10rem;
				bottom: -20rem;
				animation: right-left 12s infinite linear;
			}
			@keyframes left-right {
				from, to {
					transform: translate(-10%, -5%);
				}
				25%, 75% {
					transform: translateX(0);
				}
				50% {
					transform: translate(10%, 5%);
				}
			}
			@keyframes right-left {
				from, to {
					transform: translate(10%, 5%);
				}
				25%, 75% {
					transform: translateX(0);
				}
				50% {
					transform: translate(-10%, -5%);
				}
			}
			.welcome .circle {
				top: 0;
				bottom: 2rem;
				left: 0;
				right: 0;
				width: 1.2rem;
				height: 1.2rem;
				margin: auto auto;
				background: #fff;
				opacity: 0.4;
				border-radius: 0.6rem;
			}
			.welcome .circle1 {
				animation: poping 2s infinite linear;
			}
			.welcome .circle2 {
				animation: poping 2s 1s infinite linear;
			}
			.welcome .percent {
				display: inline-block;
				top: 0;
				bottom: 0.15rem;
				left: 0;
				right: 0;
				width: 2rem;
				height: 0.4rem;
				margin: auto auto;
				padding-left: 0.1rem;
				font-size: 0.3rem;
				text-align: center;
				color: #fff;
			}
			@keyframes poping {
				from ,to {
					transform: scale(1);
				}
				50% {
					transform: scale(0);
				}
			}
			.swiper-pagination{
				margin-bottom: 1.95rem !important;
			}
			.swiper-pagination .swiper-pagination-bullet {
				 width: 0.16rem;
				 height: 0.16rem;
			 }
			.swiper-container-horizontal > .swiper-pagination-bullets .swiper-pagination-bullet{
				margin: 0 0.075rem !important;
			}
		</style>
	</head>
	<body>
		<div id="webapp_container">
			<div class="abs full welcome" id="welcome">
				<div class="rel full overflow-hidden">
					<div class="abs grad grad1"></div>
					<div class="abs grad grad2"></div>
					<div class="abs circle circle1"></div>
					<div class="abs circle circle2"></div>
					<div class="abs percent" id="percent">0%</div>
				</div>
			</div>
			<div id="app"></div>
			<!-- built files will be auto injected -->
		</div>
		<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
		<script>
			window.onload=function(){
				!function(){
					if(window.isPC){
						var webapp=document.getElementById('webapp_container');
						webapp.className="pc";
						var width=window.pageHeight*9/16+'px';
						webapp.style.width=width;
					}
				}();
				var preLoad={
					picList:[
						'./static/img/bg.7b58bf6.png',
						'./static/img/bg.cc2db3f.png',
						'./static/img/bg-unbind.3f95d74.png',
						'./static/img/card.5cf6ad3.png',
						'./static/img/circle.a8e63ef.png',
						'./static/img/earth.972c065.png',
						'./static/img/halo.03350dd.png',
						'./static/img/list-icon1.dd35fd1.png',
						'./static/img/night-sky.cc24244.jpg',
						'./static/img/star_bg.4869690.png'
					],
					picList1:[
						'https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png',
						'https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png',
						'https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png',
					],
					loadPercent: 0,
					// 图片预加载函数
					preLoad: function(){
						var that=this;
						var list=[];
						if(window.location.origin.indexOf('aijkang.com')>-1){
							list=this.picList;
						} else {
							list=this.picList1;
						}
						var step=100/list.length;
						var welcome=document.getElementById('welcome');
						var el=document.getElementById('percent');
						for(var i=0; i<list.length; i++){
							var img=new Image();
							img.src=list[i];
							if(img.complete){
								that.loadPercent+=step;
								el.innerText=~~that.loadPercent+'%';
								if(that.loadPercent>=99){
									el.innerText='100%';
									welcome && welcome.classList.add('hide');
									window.isLoad.flag=true;
									setTimeout(function(){
										var welcome=document.getElementById('welcome');
										if(!welcome){
											return;
										}
										document.body.hasChildNodes(welcome) && document.getElementById('webapp_container').removeChild(welcome);
									},1200);
								}
							}
							img.onload=function(){
								that.loadPercent+=step;
								el.innerText=~~that.loadPercent+'%';
								if(that.loadPercent>=99){
									el.innerText='100%';
									welcome && welcome.classList.add('hide');
									window.isLoad.flag=true;
									setTimeout(function(){
										var welcome=document.getElementById('welcome');
										if(!welcome){
											return;
										}
										document.body.hasChildNodes(welcome) && document.getElementById('webapp_container').removeChild(welcome);
									},1200);
								}
							}
						}
						setTimeout(function(){
							if(that.loadPercent>=60 && that.loadPercent<99){
								welcome && welcome.classList.add('hide');
								window.isLoad.flag=true;
								setTimeout(function(){
									var welcome=document.getElementById('welcome');
									if(!welcome){
										return;
									}
									document.body.hasChildNodes(welcome) && document.getElementById('webapp_container').removeChild(welcome);
								},1200);
							} else if(that.loadPercent<60){
								window.ui && window.ui.showToast('网络不给力哦','');
							}
						},5000)
					}
				}
				preLoad.preLoad();
			}
		</script>
	</body>
</html>
